package homeWork;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LENOVO
 * Date: 2024-08-05
 * Time: 19:44
 */
public class Homework {
    public static void main(String[] args) {
        int[] nums = new int[]{-1,0,0,0,0,3,3};
        if(nums.length == 0){

        }
        int k = 1;
        for (int i = 0; i < nums.length - 1; i++) {
            if(! (nums[i] == nums[i+1])){
                nums[k] = nums[i + 1];
                k++;
            }
        }
        System.out.println(k);
        System.out.println(Arrays.toString(nums));
    }



/*    public static void main(String[] args) {
        int[] nums = new int[]{0,1,2,2,3,0,4,2};

        int val = 2;
        int j = 0;
        int count = nums.length;
        for (int i = 0; i < nums.length; i++) {
            if(!(nums[i] == val)){
                nums[j] = nums[i];
                j++;
            }else{
                count--;
            }
        }
        System.out.println(count);
        System.out.println(Arrays.toString(nums));
    }*/
}
